import { createWebHashHistory, createRouter } from "vue-router";
import index from '../view/index.vue'
import login from '../view/Login.vue'
import users from '../view/users.vue'
import products from '../view/products.vue'
import categories from '../view/categories.vue'
import orders from '../view/orders.vue'
import shoppingCar from '../view/shoppingCar.vue'
import comments from '../view/comments.vue'
import Home from '@/view/Home.vue'
import user from '../view/user.vue'
import orderStatistics from '../view/orderStatistics.vue' // 添加这一行

const routes = [
    { path: '/login', component: login },
    {
        path: '/',
        name: 'index',
        component: index,
        children: [
            { path: '', component: Home },   // 默认首页显示欢迎页
            { path: 'users', component: users },
            { path: 'categories', component: categories },
            { path: 'products', component: products },
            { path: 'orders', component: orders },
            { path: 'shoppingCar', component: shoppingCar },
            { path: 'comments', component: comments },
            { path: 'user', component: user },
            { path: 'orderStatistics', component: orderStatistics } // 添加这一行
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router
